package dsk.demo.miaosha.demo.controller;


import dsk.demo.miaosha.demo.pojo.User;
import dsk.demo.miaosha.demo.service.IOrderService;
import dsk.demo.miaosha.demo.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2022-07-17
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    IOrderService orderService;

    @RequestMapping("/detail/{orderId}")
    @ResponseBody
    public RespBean detail(@PathVariable Long orderId, User user) {
        if(user == null){
            return RespBean.error(RespBeanEnum.USER_EMPTY);
        }
        OrderDetailVo orderDetailVo = orderService.getDetail(orderId);
        return RespBean.success(orderDetailVo);
    }
}
